using System;
using System.Web.Mvc;

namespace WineCellar.Web.Helpers
{
    /// <summary>
    /// SuccessResult is an ActionResult that can be used in combination with a JQuery post.
    /// When you return a SuccessResult to JQuery post the Success callback will be triggered.
    /// </summary>
    public class SuccessResult :ActionResult
    {
        public override void ExecuteResult(ControllerContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            // 200 is the HTTP status code for succes
            context.HttpContext.Response.StatusCode = 200;
        }
    }
}